const innerAudioContext = wx.createInnerAudioContext()//音频组件初始化
Page({
  data: {
  },
  onShow() {//这里用onShow()而不是onLoad()，否则一但小程序返回再进入音频就不会播放了
    this.playmp3()
  },
  page1: function(e) {
    wx.navigateTo({
      url: '../../pages/page1/page1'
    })
  },
  playmp3: function() {
    var srcurl="cloud://cloud1-2gydc1w42610d7b4.636c-cloud1-2gydc1w42610d7b4-1306724493/music.mp3"
    innerAudioContext.autoplay = true
    innerAudioContext.src = srcurl 
    innerAudioContext.onPlay(() => {
    })
    this.mp3stop()
  },
  mp3stop: function() {
    innerAudioContext.onEnded((res) => {
       innerAudioContext.play();//监听音频暂停
    })
},
})
